import request from '@/utils/request'

// 查询基金现金流列表
export function listFundCashflow(query) {
  return request({
    url: '/cashflow/fundCashflow/list',
    method: 'get',
    params: query
  })
}

// 查询基金现金流列表
export function getFundCashflowIrr(query) {
  return request({
    url: '/cashflow/fundCashflow/irr/calc',
    method: 'get',
    params: query
  })
}

// 查询基金现金流详细
export function getFundCashflow(id) {
  return request({
    url: '/cashflow/fundCashflow/' + id,
    method: 'get'
  })
}

// 保存基金现金流
export function saveFundCashflow(data) {
  return request({
    url: '/cashflow/fundCashflow/save',
    method: 'post',
    data: data
  })
}

// 删除基金现金流
export function delFundCashflow(id) {
  return request({
    url: '/cashflow/fundCashflow/' + id,
    method: 'delete'
  })
}

// 导出基金现金流
export function exportFundCashflow(query) {
  return request({
    url: '/cashflow/fundCashflow/export',
    method: 'get',
    params: query
  })
}

// 查询现金流信息返回给Chart组件使用
export function cashFlowCharts(params) {
 return request({
   url: '/cashflow/fundCashflow/cashFlowCharts',
   method: 'get',
   params: params
 })
}

// 最新(发生时间)基金现金流
export function findLatestFundCashFlow(query) {
  return request({
    url: '/cashflow/fundCashflow/findLatestFundCashFlow',
    method: 'get',
    params: query
  })
}

// 查询基金现金流合计信息
export function getCashFlowCombined(fundId) {
  return request({
    url: '/cashflow/fundCashflow/getCashFlowCombined/' + fundId,
    method: 'get'
  })
}

export function getFundIRRHistory(dealId, type) {
  return request({
    url: '/cashflow/fundCashflow/getFundIRRHistory/' + dealId + '/' + type,
    method: 'get'
  })
}

export function getDicts(type, query) {
  return request({
    url: '/cashflow/fundCashflow/dicts/' + type,
    method: 'get',
    params: query
  })
}

export function getChart(type, query) {
  return request({
    url: '/cashflow/fundCashflow/getChart/' + type,
    method: 'get',
    params: query
  })
}

// 查询投资组合项目列表
export function findDealList(fundId) {
  return request({
    url: '/cashflow/fundCashflow/findDealList/' + fundId,
    method: 'get'
  })
}

